#ifndef _PORTS_H_
#define _PORTS_H_
//Define port usage

#ifndef SIMULATOR

#define CCP_TRIS trisc

#define BUTTON_TRIS trisa
#define BUTTON_PORT porta
#define BUTTON      3
#define enable_button_interrupt() set_bit(intcon, RABIE)
#define test_button_interrupt() test_bit(intcon, RABIF)
#define reset_button_interrupt() clear_bit(intcon, RABIF)

//3-bit control of the 8:1 Mux
#define MUX_PORT latc
#define MUX_3 6
#define MUX_2 3
#define MUX_1 4



/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
//NOTE: Define this before including <lcd_driver.h>
#define LCD_ARGS 	2,	/* Interface type: mode 0 = 8bit, 1 = 4bit(low nibble), 2 = 4bit(upper nibble) */ \
		1, 				/* Use busy signal: 1 = use busy, 0 = use time delays */\
		PORTB, TRISB, 	/* Data port and data port tris register */ \
		PORTC, TRISC, 	/* Control port and control port tris register */ \
		2,				/* Bit number of control port is connected to RS */ \
		1,				/* Bit number of control port is connected to RW */ \
		0 				/* Bit number of control port is connected to Enable */
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/

#else //ifdef SIMULATOR

#define CCP_TRIS trisb

#define BUTTON_TRIS trisb
#define BUTTON_PORT portb
#define BUTTON      0
#define enable_button_interrupt() set_bit(intcon, INT0IE)
#define test_button_interrupt() test_bit(intcon, INT0IF)
#define reset_button_interrupt() \
    clear_bit(intcon, INT0IF);   \
    intcon2.INTEDG0 ^= 1

//3-bit control of the 8:1 Mux
#define MUX_PORT latb
#define MUX_3    7
#define MUX_2    6
#define MUX_1    5



/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
//NOTE: Define this before including <lcd_driver.h>
#define LCD_ARGS 	1,	/* Interface type: mode 0 = 8bit, 1 = 4bit(low nibble), 2 = 4bit(upper nibble) */ \
		1, 				/* Use busy signal: 1 = use busy, 0 = use time delays */\
		PORTA, TRISA, 	/* Data port and data port tris register */ \
		PORTA, TRISA, 	/* Control port and control port tris register */ \
		4,				/* Bit number of control port is connected to RS */ \
		6,				/* Bit number of control port is connected to RW */ \
		7 				/* Bit number of control port is connected to Enable */
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/

#endif //SIMULATOR
#define MUX_MASK ((1<< MUX_3) | (1 << MUX_2) | (1 << MUX_1))
#endif
